﻿<%@ Page Title="Relatório de Vendas" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Vendas.aspx.cs" Inherits="Kakaroto.Administracao.Relatorios.Vendas" %>

<asp:Content ID="VendasContainer" ContentPlaceHolderID="MainContent" runat="server">

    <div class="row">
        <div class="col-md-8">
            <div class="form-horizontal">
                <h4>Informe o período que deseja consultar.</h4>
                <hr />
                <div class="form-group">
                    <div class="col-md-10">
                        <asp:Label ID="Label1" runat="server" Text="Inicio: " CssClass="control-label"></asp:Label>
                        <asp:TextBox ID="txtInicio" runat="server"></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="cldInicio" TargetControlID="txtInicio" runat="server"></ajaxToolkit:CalendarExtender>
                        &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <asp:Label ID="Label2" runat="server" Text="Fim: " CssClass="control-label"></asp:Label>
                        <asp:TextBox ID="txtFim" runat="server"></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="cldFim" TargetControlID="txtFim" runat="server"></ajaxToolkit:CalendarExtender>
                        &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <asp:Button runat="server" ID="Buscar" Text="Buscar" CssClass="btn btn-default" OnClick="Buscar_Click" />
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-8">
            <div class="form-horizontal">
                <div class="form-group">
                    <div class="col-md-10">
                        <b class="text-success">
                            <asp:Label ID="TotalRecebido" runat="server" Text="Total Recebido: R$ " CssClass="control-label"></asp:Label>
                            <asp:Label ID="Recebido" runat="server" Text="0.00" CssClass="control-label"></asp:Label>
                        </b>   
                        &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <b class="text-danger">
                            <asp:Label ID="TotalAberto" runat="server" Text="Total em Aberto: R$ " CssClass="control-label"></asp:Label>
                            <asp:Label ID="Aberto" runat="server" Text="0.00" CssClass="control-label"></asp:Label>
                        </b>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <asp:ListView ID="VendasListView" runat="server" DataSourceID="VendasDS">
        <AlternatingItemTemplate>
             <tr style="">
                <td>
                    <asp:CheckBox ID="StatusCheckBox" runat="server" Checked='<%# Eval("Status") %>' Enabled="false" CssClass="checkbox" />
                </td>
                <td>
                    <asp:Label ID="Data_do_PedidoLabel" runat="server" Text='<%# Eval("[Data do Pedido]", "{0:g}") %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="Forma_de_PagamentoLabel" runat="server" Text='<%# Eval("[Forma de Pagamento]" ) %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="DescontoLabel" runat="server" Text='<%# Eval("Desconto") + "%" %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="ServiçoLabel" runat="server" Text='<%# Eval("Serviço") + "%" %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="TotalLabel" runat="server" Text='<%# "R$ " + Eval("Total", "{0:0.00}") %>' CssClass="control-label" />
                </td>
            </tr>
        </AlternatingItemTemplate>
        <EditItemTemplate>
             <tr style="">
                <td>
                    <asp:CheckBox ID="StatusCheckBox" runat="server" Checked='<%# Eval("Status") %>' Enabled="false" CssClass="checkbox" />
                </td>
                <td>
                    <asp:Label ID="Data_do_PedidoLabel" runat="server" Text='<%# Eval("[Data do Pedido]", "{0:g}") %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="Forma_de_PagamentoLabel" runat="server" Text='<%# Eval("[Forma de Pagamento]" ) %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="DescontoLabel" runat="server" Text='<%# Eval("Desconto") + "%" %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="ServiçoLabel" runat="server" Text='<%# Eval("Serviço") + "%" %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="TotalLabel" runat="server" Text='<%# "R$ " + Eval("Total", "{0:0.00}") %>' CssClass="control-label" />
                </td>
            </tr>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" style="" class="table">
                <tr>
                    <td>Nenhuma informação encontrada.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <tr style="">
                <td>
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
                </td>
                <td>
                    <asp:CheckBox ID="StatusCheckBox" runat="server" Checked='<%# Bind("Status") %>' />
                </td>
                <td>
                    <asp:TextBox ID="Data_do_PedidoTextBox" runat="server" Text='<%# Bind("[Data do Pedido]") %>' />
                </td>
                <td>
                    <asp:TextBox ID="Forma_de_PagamentoTextBox" runat="server" Text='<%# Bind("[Forma de Pagamento]") %>' />
                </td>
                <td>
                    <asp:TextBox ID="DescontoTextBox" runat="server" Text='<%# Bind("Desconto") %>' />
                </td>
                <td>
                    <asp:TextBox ID="ServiçoTextBox" runat="server" Text='<%# Bind("Serviço") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TotalTextBox" runat="server" Text='<%# Bind("Total") %>' />
                </td>
            </tr>
        </InsertItemTemplate>
        <ItemTemplate>
            <tr style="">
                <td>
                    <asp:CheckBox ID="StatusCheckBox" runat="server" Checked='<%# Eval("Status") %>' Enabled="false" CssClass="checkbox" />
                </td>
                <td>
                    <asp:Label ID="Data_do_PedidoLabel" runat="server" Text='<%# Eval("[Data do Pedido]", "{0:g}") %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="Forma_de_PagamentoLabel" runat="server" Text='<%# Eval("[Forma de Pagamento]" ) %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="DescontoLabel" runat="server" Text='<%# Eval("Desconto") + "%" %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="ServiçoLabel" runat="server" Text='<%# Eval("Serviço") + "%" %>' CssClass="control-label" />
                </td>
                <td>
                    <asp:Label ID="TotalLabel" runat="server" Text='<%# "R$ " + Eval("Total", "{0:0.00}") %>' CssClass="control-label" />
                </td>
            </tr>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server" class="table">
                <tr runat="server">
                    <td runat="server">
                        <table id="itemPlaceholderContainer" runat="server" border="0" style="" class="table" >
                            <tr runat="server" style="">
                                <th runat="server">Status</th>
                                <th runat="server">Data do Pedido</th>
                                <th runat="server">Forma de Pagamento</th>
                                <th runat="server">Desconto</th>
                                <th runat="server">Serviço</th>
                                <th runat="server">Total</th>
                            </tr>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" style="">
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" FirstPageText="Inicio" LastPageText="Fim" NextPageText="Próxima" PreviousPageText="Anterior" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" FirstPageText="Primeira" LastPageText="Ultima" NextPageText="Próxima" PreviousPageText="Anterior" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <tr style="">
                <td>
                    <asp:CheckBox ID="StatusCheckBox" runat="server" Checked='<%# Eval("Status") %>' Enabled="false" />
                </td>
                <td>
                    <asp:Label ID="Data_do_PedidoLabel" runat="server" Text='<%# Eval("[Data do Pedido]") %>' />
                </td>
                <td>
                    <asp:Label ID="Forma_de_PagamentoLabel" runat="server" Text='<%# Eval("[Forma de Pagamento]") %>' />
                </td>
                <td>
                    <asp:Label ID="DescontoLabel" runat="server" Text='<%# Eval("Desconto") %>' />
                </td>
                <td>
                    <asp:Label ID="ServiçoLabel" runat="server" Text='<%# Eval("Serviço") %>' />
                </td>
                <td>
                    <asp:Label ID="TotalLabel" runat="server" Text='<%# Eval("Total") %>' />
                </td>
            </tr>
        </SelectedItemTemplate>
    </asp:ListView>



      





    <asp:SqlDataSource ID="VendasDS" runat="server" ConnectionString="<%$ ConnectionStrings:kakaroto-dbConnectionString %>" SelectCommand="SELECT Status_Pagamento AS 'Status', Entrada AS 'Data do Pedido', Tipo_Pagamento AS 'Forma de Pagamento', Desconto, Servico AS 'Serviço', Total FROM Pedido WHERE (Entrada >= @Inicio) AND (Entrada <= @Fim)">
        <SelectParameters>
            <asp:ControlParameter ControlID="txtInicio" PropertyName="Text" Name="Inicio"></asp:ControlParameter>
            <asp:ControlParameter ControlID="txtFim" PropertyName="Text" Name="Fim"></asp:ControlParameter>
        </SelectParameters>
    </asp:SqlDataSource>


</asp:Content>
